package com.own.business.message.center.entity.dto;

import com.own.business.message.center.entity.bo.MessageCenterGroupChildBo;
import com.own.component.common.base.entity.BaseDto;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * MessageCenterGroupChildDto
 *
 * @author chenxueli
 * @date 2023-11-13 18:17:40
 */
@Schema(title = "消息中心内容" + ConstantBeanSuffix.DTO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class MessageCenterGroupChildDto extends BaseDto<MessageCenterGroupChildBo> implements Serializable {

    @Schema(title = "分组id")
    private Long groupId;

    @Schema(title = "分组key（冗余）")
    private String groupKey;

    @Schema(title = "消息名称")
    private String name;

    @Schema(title = "消息key")
    private String messageKey;

    @Schema(title = "顺序，默认数字越小约在前面")
    private Integer sortOrder;

    /**
     * 转业务层对象
     *
     * @param entity 原业务层对象
     * @return 业务层对象
     */
    @Override
    public MessageCenterGroupChildBo toBo(MessageCenterGroupChildBo entity) {
        if (entity == null) {
            entity = new MessageCenterGroupChildBo();
        }
        entity.setGroupId(this.groupId);
        entity.setGroupKey(this.groupKey);
        entity.setName(this.name);
        entity.setMessageKey(this.messageKey);
        entity.setSortOrder(this.sortOrder);
        return super.toBo(entity);
    }

}

